using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// User_ApiLogin - 登录账号表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IUserApiLogin<T> :ModelBase<UserApiLogin> where T : UserApiLogin, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.Rowid = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return Rowid;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.Rowid=dy.Rowid;
           this.MyUserId=dy.MyUserId;
           this.ApiUserId=dy.ApiUserId;
           this.ApiId=dy.ApiId;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 自增
        /// </summary>
        private String _Rowid = "";
      
        /// <summary>
        /// 自增
        /// </summary>
        public String Rowid
        {
            get 
            {
              return   (this._Rowid); 
            }

            set 
            {
                    _Rowid= value;  
            }
        }
       
     
         /// <summary>
        /// 本站ID
        /// </summary>
        private String _MyUserId = "";
      
        /// <summary>
        /// 本站ID
        /// </summary>
        public String MyUserId
        {
            get 
            {
              return   (this._MyUserId); 
            }

            set 
            {
                    _MyUserId= value;  
            }
        }
       
     
         /// <summary>
        /// 外站ID
        /// </summary>
        private String _ApiUserId = "";
      
        /// <summary>
        /// 外站ID
        /// </summary>
        public String ApiUserId
        {
            get 
            {
              return   (this._ApiUserId); 
            }

            set 
            {
                    _ApiUserId= value;  
            }
        }
       
     
         /// <summary>
        /// ApiId
        /// </summary>
        private String _ApiId = "";
      
        /// <summary>
        /// ApiId
        /// </summary>
        public String ApiId
        {
            get 
            {
              return   (this._ApiId); 
            }

            set 
            {
                    _ApiId= value;  
            }
        }
       
     

      #endregion 定义属性 

          protected internal override void SetValue(UserApiLogin info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["Rowid"]!= DBNull.Value)
                  {
                  info.Rowid=row["Rowid"].ToString();
                 }
                 
                  
                  if(row["MyUserId"]!= DBNull.Value)
                  {
                  info.MyUserId=row["MyUserId"].ToString();
                 }
                 
                  
                  if(row["ApiUserId"]!= DBNull.Value)
                  {
                  info.ApiUserId=row["ApiUserId"].ToString();
                 }
                 
                  
                  if(row["ApiId"]!= DBNull.Value)
                  {
                  info.ApiId=row["ApiId"].ToString();
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, UserApiLogin info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@Rowid", DbType.String,ParameterTool.GetObj( info._Rowid )); 
            
             
                cn.AddInParameter(comm, "@MyUserId", DbType.String,ParameterTool.GetObj( info._MyUserId )); 
            
             
                cn.AddInParameter(comm, "@ApiUserId", DbType.String,ParameterTool.GetObj( info._ApiUserId )); 
            
             
                cn.AddInParameter(comm, "@ApiId", DbType.String,ParameterTool.GetObj( info._ApiId )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 